package com.pzy.satoken.controller;

import cn.dev33.satoken.annotation.SaIgnore;
import cn.dev33.satoken.stp.StpUtil;
import cn.dev33.satoken.util.SaResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author pzy
 */
@RestController
@RequestMapping("permission")
public class PermissionController {

    @SaIgnore
    @RequestMapping("permission")
    public SaResult permissionList() {
        List<String> permissionList = StpUtil.getPermissionList();
        return SaResult.data(permissionList);
    }

    @SaIgnore
    @RequestMapping("role")
    public SaResult roleList() {
        List<String> roleList = StpUtil.getRoleList();
        return SaResult.data(roleList);
    }
}
